﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using ERP_RORZE_TOOL.Common;
using ERP_RORZE_TOOL.DBAccess;

namespace ERP_RORZE_ORDER.OrderObject.UserControls
{
    public partial class ucGridViewPrint : DevExpress.XtraEditors.XtraUserControl
    {
        public ucGridViewPrint(string orderNo)
        {
            InitializeComponent();

            gridControl1.DataSource = BaseDAO.ExecuteQuery("Sp_243_Rpt_QInDatHang N'" + orderNo + "'");
            gridView1.ViewCaption = orderNo;

            gridView1.Columns["Quantity"].DisplayFormat.FormatType = FormatType.Numeric;
            gridView1.Columns["Quantity"].DisplayFormat.FormatString = "n0";

            gridView1.Columns["Price"].DisplayFormat.FormatType = FormatType.Numeric;
            gridView1.Columns["Price"].DisplayFormat.FormatString = "n2";

            gridView1.Columns["Amount"].DisplayFormat.FormatType = FormatType.Numeric;
            gridView1.Columns["Amount"].DisplayFormat.FormatString = "n2";

            gridView1.Columns["ExchangeRate"].DisplayFormat.FormatType = FormatType.Numeric;
            gridView1.Columns["ExchangeRate"].DisplayFormat.FormatString = "n2";

            gridView1.Columns["AmountUSD"].DisplayFormat.FormatType = FormatType.Numeric;
            gridView1.Columns["AmountUSD"].DisplayFormat.FormatString = "n2";
        }

        private void btExport_Click(object sender, EventArgs e)
        {
            Utilities.ExportToExcel(gridView1, 1, true);
        }
    }
}
